package com.marry.webservice.webservice;

import com.marry.webservice.bean.OperationResult;
import com.marry.webservice.service.DemoService;
import org.apache.cxf.common.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import javax.jws.WebService;


/**
 * @author ml
 * @create 2017-09-20--14:03
 */
@WebService(serviceName = "LayoutServiceImpl",
        portName = "LayoutImpl", targetNamespace = "http://webservice.webservice.marry.com",
        endpointInterface = "com.marry.webservice.webservice.Layout")
public class LayoutImpl implements Layout {

    private static final Logger logger = LoggerFactory.getLogger(LayoutImpl.class);

    @Autowired
    DemoService demoService;

    @Override
    public String sayHi(String name) {
        demoService.getById(2L).getName();
        return "hello" + demoService.getById(2L).getName()+"+"+name;
    }

    @Override
    public OperationResult addLayout(String layoutName, String layoutContent) {

        logger.info("layoutName:{},layoutContent:{}", layoutName, layoutContent);

        if (StringUtils.isEmpty(layoutName) || StringUtils.isEmpty(layoutContent)) {

            return new OperationResult(false, "参数不能玩为空");
        }
        return new OperationResult(true, null);
    }
}
